package com.onenine.app.utils;

import android.content.Context;

import com.onenine.app.R;
import com.onenine.base.utils.AppConfig;
import com.onenine.common.util.ApUtils;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.filter.Filter;
import com.zhihu.matisse.internal.entity.IncapableCause;
import com.zhihu.matisse.internal.entity.Item;

import java.util.Set;

/**
 * 视频过滤器
 */
public class VideoFilter extends Filter {

    @Override
    protected Set<MimeType> constraintTypes() {
        return null;
    }

    @Override
    public IncapableCause filter(Context context, Item item) {
        return item.duration > AppConfig.VIDEO_MAX_DURATION
                && item.size > AppConfig.VIDEO_MAX_SIZE ? new IncapableCause(IncapableCause.TOAST
                , ApUtils.getApp().getString(R.string.video_duration_limit)) : null;
    }

}